packages <- c("rio", "tidyverse", "janitor", "lubridate", "rmarkdown", "fs", "hms", "zoo", "corrplot", "kableExtra",
"psych", "DescTools", "ggplot2")
for (pkg in packages) {
if (!requireNamespace(pkg, quietly = TRUE)) {
install.packages(pkg)
}
}Nomilo Fishpond Biogoechemical Analysis
Introduction
[Explain the purpose of this website]
Research Questions
- How do changes in the Nomilo fishpond over time correlate with
Throughout this document, hover over the numbered annotations to the right of code chunks to reveal detailed explanations and comments about the code. Where drop-down italicized text is present, expand by pressing on arrow to see code.
Install Packages
Load Libraries
library(rio)
library(tidyverse)
library(janitor)
library(lubridate)
library(rmarkdown)
library(fs)
library(hms)
library(zoo)
library(corrplot)
library(kableExtra)
library(psych)
library(DescTools)
library(ggplot2)- 1
- For importing excel data
- 2
- For cleaning of data
- 3
- For cleaning variable names
- 4
- For cleaning dates
- 5
- For displaying tables
- 6
- For file path usage
Import Raw Data
Procedure
Define vector of files to import:
files_to_import <- dir_ls(path = "data/raw")
for (i in seq_along(files_to_import)) {
cat(i, "= ", files_to_import[i], "\n")
}- 1
-
Store the file paths of our raw data within the
data/rawdirectory infiles_to_import - 2
- Print each file path with its index
1 = data/raw/2024-02-28_dfs.RData
2 = data/raw/2024-02-28_ksf-clam-growth.xlsx
3 = data/raw/2024-02-28_ksf-compiled-data.xlsx
4 = data/raw/2024-02-28_ksf-oyster-cylinder-growth.xlsx
5 = data/raw/2024-02-28_profile-data.xlsx
6 = data/raw/2024-02-28_water-samples.xlsx
7 = data/raw/2024-02-28_weather-data.xlsx
8 = data/raw/2024-03-01_dfs-no-profiles.RData
9 = data/raw/2024-03-01_dfs_no_profiles.RData
10 = data/raw/2024-03-04_dfs-no-profiles.RData
11 = data/raw/~$2024-02-28_weather-data.xlsx
Use the purrr::map() function to iteratively import files in the files_to_import vector except for the profiles data and .RData files:
The @iteratively-import-raw-data code chunk should only be ran once when raw data is updated because it takes long to execute. Therefore, run the @efficiently-load-raw-data code chunk instead to easily import up-to-date raw data.
dfs_no_profiles <- map(files_to_import[c(2:4, 6, 7)], import_list)
current_date <- format(Sys.Date(), "%Y-%m-%d")
save(dfs_no_profiles, file = paste0("data/raw/", current_date, "_dfs-no-profiles.RData"))Refer to the output of the files_to_import data object to ensure you are inputting the correct index value corresponding to the file path that needs to be loaded.
Efficiently import up-to-date raw data:
load(files_to_import[10])Rename datasets:
We will always use snakecase when naming our data objects and functions (e.g., data_object_name or function_name()).
names(dfs_no_profiles) <- gsub("data/raw/2024-02-28_|\\.xlsx$|\\.xls$", "",
files_to_import[c(2:4, 6, 7)])
names(dfs_no_profiles) <- gsub("-", "_", names(dfs_no_profiles))
names(dfs_no_profiles)- 1
- Remove prefixes and file extensions
- 2
- Replace hyphens with underscores
- 3
- Check if names were outputted correctly
[1] "ksf_clam_growth" "ksf_compiled_data"
[3] "ksf_oyster_cylinder_growth" "water_samples"
[5] "weather_data"
Rename each sheet within each raw dataset to be lowercased and replace spaces with underscores:
dfs_no_profiles <- map(dfs_no_profiles, ~ set_names(.x, gsub(" ", "_", tolower(names(.x)))))Create separate datasets by specifying the Excel sheet from each spreadsheet we want to tidy:
ksf_clams_growth_data <- dfs_no_profiles$ksf_clam_growth$sheet1
ksf_compiled_data <- dfs_no_profiles$ksf_compiled_data$full_data
ksf_oyster_cylinder_growth_data <- dfs_no_profiles$ksf_oyster_cylinder_growth$sheet1
water_samples_data <- dfs_no_profiles$water_samples$data_overview
weather_data <- dfs_no_profiles$weather_data$weather_ksf
tidal_data <- dfs_no_profiles$ksf_compiled_data$tidesWe want to combine multiple sheets within the profiles Excel spreadsheet into one, therefore, we will import it separately:
sheets_to_import <- c("L1", "L2", "L3", "L4")
profiles_data <- profiles_data <- map_dfr(sheets_to_import, function(sheet_name) {
import(files_to_import[5], which = sheet_name)
}) %>%
bind_rows()- 1
- [code annotation]
- 2
- [code annotation]
- 3
- [code annotation]
View Raw Data
Tidy Raw Data
Tidying Processes
Steps to clean data
new_clam_var_names <- c(
"sort_date", "color", "clams_in_count", "clams_in_lbs", "clams_in_avg_per_lb",
"clams_out_count", "clams_out_lbs", "clams_out_avg_per_lb", "growth_in_lbs",
"growth_pct", "sr", "days_btwn_sort"
)
new_clam_date_col <- c(
"2023-10-17", "2023-12-06", "2023-12-12", "2024-01-02", "2024-01-10", "2024-01-24",
"2024-01-31", "2024-02-08", "2024-02-13"
)
ksf_clams_growth_data_tidied <- ksf_clams_growth_data %>%
slice(-1) %>%
setNames(new_clam_var_names) %>%
mutate(date = as.Date(new_clam_date_col)) %>%
dplyr::select(-sort_date) %>%
pivot_longer(
cols = c(
clams_in_count, clams_in_lbs, clams_in_avg_per_lb, clams_out_count,
clams_out_lbs, clams_out_avg_per_lb
),
names_to = c("stage", ".value"),
names_prefix = "clams_",
names_sep = "_",
values_to = "value"
) %>%
mutate(stage = if_else(str_detect(stage, "in"), "In", "Out")) %>%
rename(avg_per_lbs = avg) %>%
mutate(across(c(color, stage), as.factor)) %>%
mutate(across(c(count, lbs, avg_per_lbs, growth_in_lbs, growth_pct, sr),
~as.numeric(gsub("%", "", .)))) %>%
arrange(date, color, stage) %>%
dplyr::select(date, days_btwn_sort, color, stage, count, lbs, avg_per_lbs,
growth_in_lbs, growth_pct, sr) %>%
rename("days_btwn_clams_sort" = days_btwn_sort,
"clams_color" = color,
"clams_stage" = stage,
"clams_count" = count,
"weight" = lbs,
"avg_weight" = avg_per_lbs,
"clams_growth" = growth_in_lbs,
"clams_sr" = sr)
paged_table(ksf_clams_growth_data_tidied)- 1
- Manually set variable names
- 2
- Assign dates to new date column
- 3
- Delete first row
- 4
- Set date as correct variable type and pivot data set based on date range.
- 5
- Assign In and Out to stage
- 6
- Rename variable of average to average per lbs
- 7
- Set stage and color as factor variable types
- 8
- Set variables as numeric variable types
- 9
- Arrange values by date, color, and stage
Steps to clean data
ksf_compiled_data_tidied <- ksf_compiled_data %>%
rename_with(~gsub("\\s*\\([^\\)]+\\)", "", .x)) %>%
janitor::clean_names() %>%
rename(date = date_time) %>%
mutate(date = as.Date(date)) %>%
filter(date >= as.Date("2023-11-20") & date <= as.Date("2024-02-20")) %>%
arrange(date) %>%
dplyr::select(-c(external_voltage, wk_num, wind_dir,
spadd, outdoor_temperature, hourly_rain,
solar_radiation, resistivity, battery_capacity,
hour, daynum, data_pt, wind_sp, diradd,
wind_speed, wind_direction, tide, day, month, year)
) %>%
dplyr::select(where(~ !anyNA(.))) %>%
group_by(date) %>%
summarise(across(where(is.numeric), \(x) mean(x, na.rm = TRUE))) %>%
rename("ksf_salinity" = salinity,
"ksf_rdo_saturation" = rdo_saturation,
"ksf_rdo_concentration" = rdo_concentration,
"ksf_actual_conductivity" = actual_conductivity,
"ksf_total_dissolved_solids" = total_dissolved_solids,
"ksf_ammonium" = ammonium,
"ksf_barometric_pressure" = barometric_pressure,
"ksf_oxygen_partial_pressure" = oxygen_partial_pressure,
"ksf_specific_conductivity" = specific_conductivity,
"ksf_density" = density,
"ksf_chlorophyll_a_fluorescence" = chlorophyll_a_fluorescence,
"ksf_ammonium_m_v" = ammonium_m_v)
paged_table(ksf_compiled_data_tidied)- 1
- Clean variable names by removing everything in parentheses, using lowercase and underscores in place of spaces
- 2
-
Rename the
date_timevariable todate, filter to desired date range and sort bydate - 3
- Remove unnecessary variables
- 4
- Remove columns with containing all NA values
- 5
-
Group by
dateand calculate the average of every variable for each day
Steps to clean data
oyster_var_names <- c(
"date", "oyster_large_weight", "oyster_large_gain", "oyster_small_weight",
"oyster_small_gain", "oyster_chlorophyll"
)
ksf_oyster_cylinder_growth_data_tidied <- ksf_oyster_cylinder_growth_data %>%
dplyr::select(c(1, 4, 5, 8, 9, 12)) %>%
slice(-1) %>%
setNames(oyster_var_names) %>%
pivot_longer(
cols = c(oyster_large_weight, oyster_large_gain,
oyster_small_gain,
oyster_small_weight),
names_to = c("oyster_size", ".value"),
names_prefix = "oyster_",
names_sep = "_",
values_to = "value"
) %>%
mutate(oyster_size = if_else(str_detect(oyster_size, "small"), "Small", "Large")) %>%
mutate(date = as.Date(date),
oyster_size = as.factor(oyster_size),
across(c(weight, gain), as.numeric)
) %>%
filter(date >= as.Date("2023-11-20") & date <=
as.Date("2024-02-14")) %>%
mutate(weight = weight * 0.00220462) %>%
rename("growth_pct" = gain)
paged_table(ksf_oyster_cylinder_growth_data_tidied)- 1
- Manually set variable names
- 2
- Select desired columns and remove first row
- 3
- Convert from wide to long format
- 4
- Create a new variable that differentiates oyster size
- 5
- Adjust data types to numeric and factor
- 6
- Filter to desired date range
Steps to clean data
water_samples_data_tidied <- water_samples_data %>%
slice(-c(44:52)) %>%
rename_with(~gsub("\\s*\\([^\\)]+\\)", "", .x)) %>%
janitor::clean_names() %>%
mutate(
date = if_else(date == "44074",
as.character(as.Date("2024-01-09")),
format(dmy(date), "%Y-%m-%d"))
) %>%
mutate(sample_id = 1:nrow(.)) %>%
mutate(date = as.Date(date),
across(c(nomilo_id, location, round, depth), as.factor)) %>%
select(-c(sample_id, nomilo_id, tube_name))
paged_table(water_samples_data_tidied)- 1
- Clean variable names by removing everything in parentheses, using lowercase and underscores in place of spaces
- 2
- Replaces incorrect date values and format as YYYY-MM-DD
- 3
- Add values for sample ID
- 4
- Set correct variable types
Steps to clean data
weather_data_tidied <- weather_data %>%
janitor::clean_names() %>%
unite(date, year, month, day, sep = "-") %>%
mutate(date = ymd(date)) %>%
select(-c(1, 3)) %>%
rename("outdoor_temperature" = outdoor_temp_f) %>%
mutate(outdoor_temperature = (outdoor_temperature - 32) * (5/9)) %>%
group_by(date) %>%
summarise(across(where(is.numeric), \(x) mean(x, na.rm = TRUE))) %>%
slice(-1)
paged_table(weather_data_tidied)- 1
- Clean variable names
- 2
- Merge separate day, month, year columns into one column variable and format as YYYY-MM-DD.
- 3
- Cut columns
- 4
- Rename outdoor temperature and convert from Fahrenheit to Celcius
- 5
- Group by date and then take average values per day
- 6
- Cut first row
Steps to clean data
new_profile_var_names <- c("depth", "water_temperature", "dissolved_oxygen", "salinity", "conductivity", "visibility", "location", "date")
profiles_data_tidied <- profiles_data %>%
select(-c(6, 8)) %>%
mutate(
temp_column1 = NA_character_,
temp_column2 = NA_character_
) %>%
setNames(new_profile_var_names) %>%
mutate(
location = ifelse(depth == "Location", water_temperature, NA_character_),
date = ifelse(depth == "Date", water_temperature, NA_character_)
) %>%
fill(location, date, .direction = "down") %>%
filter(depth != "Location", depth != "Date") %>%
mutate(
location = case_when(
location == "L1 Northwest buoy" ~ "back buoy",
location == "L2 Middle Buoy" ~ "mid buoy",
location == "L3 Production Dock" ~ "production dock",
location == "L4 Auwai" ~ "auwei",
TRUE ~ location
),
date = case_when(
date %in% c("45258", "2023-11-28") ~ "2023-11-28",
date %in% c("45282", "2023-12-21") ~ "2023-12-21",
date %in% c("45536", "2024-01-09") ~ "2024-01-09",
date %in% c("30/1/24", "30/01/24") ~ "2024-01-30",
date %in% c("20/02/24", "20/2/24") ~ "2024-02-20",
TRUE ~ date
)) %>%
mutate(
date = as.Date(date, format = "%Y-%m-%d"),
conductivity = case_when(
row_number() %in% c(1:11) ~ NA_character_,
TRUE ~ as.character(conductivity)
)
) %>%
filter(!(depth %in% c("Samples", "Depth"))) %>%
mutate(date = as.Date(date),
across(c(depth, location), as.factor),
across(c(water_temperature, dissolved_oxygen, salinity,
conductivity,visibility), as.numeric)) %>%
fill(visibility, .direction = "down") %>%
mutate(visibility = if_else(date == "2023-11-28", NA_real_, visibility))
paged_table(profiles_data_tidied)- 1
- Set new variable names manually
- 2
- Delete unnecessary columns
- 3
- Temporarily create two new columns to replace the ones we deleted
- 4
- Assign new profile variable names to rename variables in data set
- 5
- Takes location from one column of location and date data, and assigns it to corresponding data of another column.
- 6
- Fill values of temperature downwards in newly created date and location column.
- 7
- Gets rid of the ‘location’ and ‘date’ rows that had empty values.
- 8
- Renames values
- 9
- Removes turbidity data rows 1:11
- 10
- Looks for rows containing samples and depth names and negate these values.
- 11
- Sets correct data types for each variable
- 12
- Fills values from the temperature downwards into the newly created columns for date and location
Steps to clean data
tidal_data_tidied <- tidal_data %>%
janitor::clean_names() %>%
mutate(date = as.Date(date, format = "%Y-%m-%d")) %>%
filter(date >= as.Date("2023-11-20") & date <= as.Date("2024-02-20")) %>%
select(-2) %>%
mutate(time = as_hms(format(time, "%H:%M:%S")),
high_low = as.factor(high_low))
paged_table(tidal_data_tidied)- 1
- Clean variable names
- 2
- Set date as correct variable type and format YYYY-MM-DD
- 3
- Filter to desired date range
- 4
- Cut column
- 5
- Set time as time variable type
- 6
- Set variable as factor type
Merge and Impute Tidied Datasets
# Merging
profiles_water_samples_merged <- reduce(list(profiles_data_tidied, water_samples_data_tidied), full_join, by = c("date", "location", "depth")) %>%
relocate(date, round, location, depth, .before = water_temperature) %>%
arrange(date) %>%
fill(round, .direction = "down") %>%
mutate(round = if_else(is.na(round), "1", round),
round = as.factor(round))# Interpolating
profiles_water_samples_interp <- profiles_water_samples_merged %>%
# Selects numeric columns with missing values, linearly interpolates NAs by
# drawing straight lines between existing points, and extends the outermost
# values to fill NAs at the start or end
mutate(across(where(~is.numeric(.x) && any(is.na(.x))),
~na.approx(.x, na.rm = FALSE, rule = 2)))# Complete dataset
compiled_weather_merged <- reduce(list(ksf_compiled_data_tidied, weather_data_tidied), full_join, by = "date")# Merging interpolated and completed datasets
env_vars <- left_join(profiles_water_samples_interp, compiled_weather_merged, by = "date")
paged_table(env_vars)Clams Growth Merged with Environmental Variables
# Merging
clams_growth_env_vars_merged <- full_join(ksf_clams_growth_data_tidied, env_vars, by = "date")
# Interpolating -- other option is to aggregate to weekly or monthly, but dates
# are very mismatched to aggregate to monthly and dataset would be very small if
# aggregated to monthly
clams_growth_env_vars_interp <- clams_growth_env_vars_merged %>%
mutate(across(
.cols = setdiff(names(.)[sapply(., function(col) is.numeric(col) &&
any(is.na(col)))], "days_btwn_clams_sort"),
.fns = ~na.approx(.x, na.rm = FALSE, rule = 2)
)) %>%
relocate(date, round, location, depth, clams_color, clams_stage, .before = days_btwn_clams_sort) %>%
arrange(date)Processed Datasets
Export Tidied Datasets
Export tidied datasets to CSV into data/tidied folder:
source("code/functions/export_to_csv.R")
dfs_to_export <- list(
ksf_clams_growth_data_tidied = ksf_clams_growth_data_tidied,
ksf_compiled_data_tidied = ksf_compiled_data_tidied,
ksf_oyster_cylinder_growth_data_tidied = ksf_oyster_cylinder_growth_data_tidied,
water_samples_data_tidied = water_samples_data_tidied,
profiles_data_tidied = profiles_data_tidied
)
imap(dfs_to_export, ~ export_to_csv(.x, .y, "data/tidied"))- 1
- List of dataframes we want to export as CSV files
- 2
-
Iterate the
export_to_csv(df, df_name, dir_path)function over each dataframe..xrefers to the dataframe..yrefers to the name of the dataframe. These are passed toexport_to_csv()function along with the desired directory path.
Export merged final data set into data/outputs folder.
Data Dictionaries
Correlational Analysis
All Relationships
| clams_count | weight | avg_weight | clams_growth | growth_pct | clams_sr | water_temperature | dissolved_oxygen | salinity | conductivity | visibility | chlorophyll_a | phosphate | silicate | nitrate_nitrite | ammonia | heterotrophic_bacteria | large_phytoplankton | synechococcus_population_1 | synechococcus_population_2 | prochlorococcus | lysbeths_mystery_cells_events | ksf_rdo_concentration | ksf_rdo_saturation | ksf_oxygen_partial_pressure | ksf_actual_conductivity | ksf_specific_conductivity | ksf_salinity | ksf_density | ksf_total_dissolved_solids | ksf_chlorophyll_a_fluorescence | ksf_ammonium | ksf_ammonium_m_v | ksf_barometric_pressure | outdoor_temperature | wind_speed_mph | hourly_rain_inch_hr | wind_direction | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| clams_count | 1.0000000 | 0.0355727 | 0.6405208 | 0.3824666 | 0.2060385 | 0.3153983 | 0.1022072 | 0.1619238 | 0.1845178 | -0.1677928 | -0.0262287 | -0.0348903 | -0.0012266 | -0.0009398 | -0.0103139 | -0.0296319 | 0.0985540 | -0.0437220 | 0.1097342 | -0.0530999 | -0.0485831 | -0.0273381 | -0.1436172 | -0.1289034 | -0.1311758 | 0.1438958 | 0.1306499 | 0.1321445 | 0.1080420 | 0.1306499 | -0.1107102 | 0.1373160 | 0.1237988 | -0.0489557 | 0.1373359 | -0.1165144 | 0.1653751 | 0.0177785 |
| weight | 0.0355727 | 1.0000000 | -0.3495515 | -0.0602614 | -0.1737631 | -0.4959432 | 0.1474940 | 0.2336704 | 0.2662755 | -0.2421398 | -0.0378504 | -0.0503498 | -0.0017701 | -0.0013562 | -0.0148838 | -0.0427615 | 0.1422221 | -0.0630948 | 0.1583561 | -0.0766279 | -0.0701097 | -0.0394513 | -0.2072523 | -0.1860190 | -0.1892982 | 0.2076543 | 0.1885393 | 0.1906962 | 0.1559142 | 0.1885393 | -0.1597646 | 0.1981592 | 0.1786526 | -0.0706475 | 0.1981878 | -0.1681406 | 0.2386508 | 0.0256559 |
| avg_weight | 0.6405208 | -0.3495515 | 1.0000000 | 0.4828974 | 0.4290654 | 0.4987577 | 0.0782383 | 0.1239506 | 0.1412460 | -0.1284432 | -0.0200778 | -0.0267081 | -0.0009389 | -0.0007194 | -0.0078951 | -0.0226828 | 0.0754418 | -0.0334687 | 0.0840001 | -0.0406473 | -0.0371897 | -0.0209270 | -0.1099371 | -0.0986739 | -0.1004133 | 0.1101503 | 0.1000108 | 0.1011549 | 0.0827048 | 0.1000108 | -0.0847472 | 0.1051136 | 0.0947664 | -0.0374750 | 0.1051289 | -0.0891903 | 0.1265925 | 0.0136092 |
| clams_growth | 0.3824666 | -0.0602614 | 0.4828974 | 1.0000000 | 0.8878782 | 0.0607421 | -0.0291305 | -0.0461506 | -0.0525902 | 0.0478233 | 0.0074756 | 0.0099442 | 0.0003496 | 0.0002679 | 0.0029396 | 0.0084455 | -0.0280893 | 0.0124614 | -0.0312758 | 0.0151342 | 0.0138469 | 0.0077918 | 0.0409330 | 0.0367393 | 0.0373870 | -0.0410123 | -0.0372371 | -0.0376631 | -0.0307935 | -0.0372371 | 0.0315540 | -0.0391370 | -0.0352844 | 0.0139531 | -0.0391427 | 0.0332083 | -0.0471342 | -0.0050671 |
| growth_pct | 0.2060385 | -0.1737631 | 0.4290654 | 0.8878782 | 1.0000000 | 0.1067633 | 0.0150507 | 0.0238444 | 0.0271715 | -0.0247086 | -0.0038624 | -0.0051378 | -0.0001806 | -0.0001384 | -0.0015188 | -0.0043635 | 0.0145127 | -0.0064384 | 0.0161591 | -0.0078193 | -0.0071542 | -0.0040257 | -0.0211486 | -0.0189819 | -0.0193165 | 0.0211896 | 0.0192391 | 0.0194592 | 0.0159099 | 0.0192391 | -0.0163028 | 0.0202207 | 0.0182302 | -0.0072091 | 0.0202236 | -0.0171575 | 0.0243526 | 0.0026180 |
| clams_sr | 0.3153983 | -0.4959432 | 0.4987577 | 0.0607421 | 0.1067633 | 1.0000000 | -0.0054952 | -0.0087058 | -0.0099206 | 0.0090214 | 0.0014102 | 0.0018759 | 0.0000659 | 0.0000505 | 0.0005545 | 0.0015932 | -0.0052987 | 0.0023507 | -0.0058999 | 0.0028549 | 0.0026121 | 0.0014698 | 0.0077216 | 0.0069305 | 0.0070527 | -0.0077365 | -0.0070244 | -0.0071047 | -0.0058089 | -0.0070244 | 0.0059523 | -0.0073828 | -0.0066560 | 0.0026321 | -0.0073839 | 0.0062644 | -0.0088914 | -0.0009559 |
| water_temperature | 0.1022072 | 0.1474940 | 0.0782383 | -0.0291305 | 0.0150507 | -0.0054952 | 1.0000000 | 0.5558122 | 0.5516868 | -0.6000653 | 0.4363155 | 0.0585114 | -0.0389025 | -0.0227928 | -0.0309335 | 0.1185653 | 0.2806250 | -0.4816218 | 0.1636278 | -0.1231133 | -0.2893156 | -0.4716154 | -0.5166439 | -0.3553506 | -0.3772395 | 0.6197604 | 0.3225874 | 0.3415458 | 0.0560902 | 0.3225874 | -0.5650242 | 0.5483843 | 0.5623647 | -0.4978297 | 0.8585334 | -0.5033829 | 0.5289864 | 0.4463074 |
| dissolved_oxygen | 0.1619238 | 0.2336704 | 0.1239506 | -0.0461506 | 0.0238444 | -0.0087058 | 0.5558122 | 1.0000000 | 0.8985637 | -0.9701901 | -0.1757068 | -0.1464860 | 0.0535226 | 0.0890727 | 0.0262530 | -0.1700521 | 0.3031918 | -0.2924468 | 0.4861053 | -0.3531957 | -0.3698611 | -0.2115388 | -0.8467521 | -0.7597832 | -0.7731839 | 0.8572035 | 0.7844858 | 0.7930486 | 0.6540607 | 0.7844857 | -0.6416924 | 0.8035290 | 0.7207022 | -0.2696323 | 0.8087275 | -0.6944782 | 0.9810440 | 0.1119834 |
| salinity | 0.1845178 | 0.2662755 | 0.1412460 | -0.0525902 | 0.0271715 | -0.0099206 | 0.5516868 | 0.8985637 | 1.0000000 | -0.8914021 | -0.1393423 | -0.1610532 | -0.0168530 | 0.0123002 | -0.0488696 | -0.1738178 | 0.4294608 | -0.2973534 | 0.5183612 | -0.3029770 | -0.3145862 | -0.1766901 | -0.7629781 | -0.6848098 | -0.6968818 | 0.7644578 | 0.6940880 | 0.7020285 | 0.5739821 | 0.6940879 | -0.5881569 | 0.7295025 | 0.6576912 | -0.2600813 | 0.7296081 | -0.6189924 | 0.8785684 | 0.0944497 |
| conductivity | -0.1677928 | -0.2421398 | -0.1284432 | 0.0478233 | -0.0247086 | 0.0090214 | -0.6000653 | -0.9701901 | -0.8914021 | 1.0000000 | 0.0818488 | 0.0025717 | -0.0712656 | -0.1085205 | -0.0360881 | 0.0949660 | -0.3410900 | 0.3653268 | -0.5241176 | 0.3225338 | 0.2879479 | 0.3252597 | 0.8556151 | 0.7702641 | 0.7836693 | -0.8255741 | -0.7313530 | -0.7408918 | -0.5891799 | -0.7313529 | 0.7228236 | -0.8555610 | -0.7877465 | 0.3821246 | -0.8223712 | 0.6758726 | -0.9693002 | -0.0466016 |
| visibility | -0.0262287 | -0.0378504 | -0.0200778 | 0.0074756 | -0.0038624 | 0.0014102 | 0.4363155 | -0.1757068 | -0.1393423 | 0.0818488 | 1.0000000 | 0.5616956 | -0.0256629 | -0.0383323 | -0.0161023 | 0.4443328 | 0.0541566 | -0.3212999 | -0.2182022 | 0.0592861 | 0.0323141 | -0.4649042 | 0.1558650 | 0.2484340 | 0.2365961 | 0.0052714 | -0.1941453 | -0.1843236 | -0.3357863 | -0.1941452 | -0.2367591 | 0.0313374 | 0.1140873 | -0.4225706 | 0.2624077 | -0.0929600 | -0.1672147 | 0.1253806 |
| chlorophyll_a | -0.0348903 | -0.0503498 | -0.0267081 | 0.0099442 | -0.0051378 | 0.0018759 | 0.0585114 | -0.1464860 | -0.1610532 | 0.0025717 | 0.5616956 | 1.0000000 | 0.0154005 | 0.0278190 | -0.0251575 | 0.3056080 | 0.2061497 | -0.4518157 | 0.2014414 | 0.2773985 | 0.3374826 | -0.6094626 | -0.0050217 | -0.0380127 | -0.0349428 | -0.2513800 | -0.3310065 | -0.3280774 | -0.3610691 | -0.3310064 | -0.4157040 | 0.2537830 | 0.3362441 | -0.5945120 | -0.0268099 | 0.1617641 | -0.1120089 | -0.4595305 |
| phosphate | -0.0012266 | -0.0017701 | -0.0009389 | 0.0003496 | -0.0001806 | 0.0000659 | -0.0389025 | 0.0535226 | -0.0168530 | -0.0712656 | -0.0256629 | 0.0154005 | 1.0000000 | 0.9912902 | 0.9905710 | 0.4138130 | -0.2914983 | 0.4969628 | -0.0950366 | -0.0809316 | -0.0041656 | -0.1171863 | -0.1344232 | -0.1308590 | -0.1317650 | 0.1047154 | 0.1018370 | 0.1026068 | 0.0904010 | 0.1018370 | -0.1197253 | 0.1410965 | 0.1307563 | -0.0672692 | 0.0993488 | -0.0852763 | 0.1471302 | -0.0396601 |
| silicate | -0.0009398 | -0.0013562 | -0.0007194 | 0.0002679 | -0.0001384 | 0.0000505 | -0.0227928 | 0.0890727 | 0.0123002 | -0.1085205 | -0.0383323 | 0.0278190 | 0.9912902 | 1.0000000 | 0.9903293 | 0.3598682 | -0.2261271 | 0.4603792 | -0.0168358 | -0.0254006 | 0.0380775 | -0.1542340 | -0.2014642 | -0.2037169 | -0.2040706 | 0.1052736 | 0.0890158 | 0.0907086 | 0.0687774 | 0.0890157 | -0.1650062 | 0.2009432 | 0.1915257 | -0.1136263 | 0.1188869 | -0.0644572 | 0.1850664 | -0.0544627 |
| nitrate_nitrite | -0.0103139 | -0.0148838 | -0.0078951 | 0.0029396 | -0.0015188 | 0.0005545 | -0.0309335 | 0.0262530 | -0.0488696 | -0.0360881 | -0.0161023 | -0.0251575 | 0.9905710 | 0.9903293 | 1.0000000 | 0.3709471 | -0.3234921 | 0.5309247 | -0.1410379 | -0.0828597 | -0.0164020 | -0.0856175 | -0.1041178 | -0.0933389 | -0.0949881 | 0.1021954 | 0.0909207 | 0.0920965 | 0.0735761 | 0.0909207 | -0.0765626 | 0.0969253 | 0.0873281 | -0.0335760 | 0.0989055 | -0.0805020 | 0.1173145 | 0.0188051 |
| ammonia | -0.0296319 | -0.0427615 | -0.0226828 | 0.0084455 | -0.0043635 | 0.0015932 | 0.1185653 | -0.1700521 | -0.1738178 | 0.0949660 | 0.4443328 | 0.3056080 | 0.4138130 | 0.3598682 | 0.3709471 | 1.0000000 | -0.1856736 | 0.0829682 | -0.3732082 | -0.1399596 | 0.0154112 | -0.2548711 | 0.1840851 | 0.2426998 | 0.2353614 | 0.0355366 | -0.0304794 | -0.0277145 | -0.0820428 | -0.0304793 | -0.0973703 | -0.0452545 | -0.0062371 | -0.1699896 | 0.1234077 | -0.1355399 | -0.1118940 | 0.0288094 |
| heterotrophic_bacteria | 0.0985540 | 0.1422221 | 0.0754418 | -0.0280893 | 0.0145127 | -0.0052987 | 0.2806250 | 0.3031918 | 0.4294608 | -0.3410900 | 0.0541566 | 0.2061497 | -0.2914983 | -0.2261271 | -0.3234921 | -0.1856736 | 1.0000000 | -0.5269331 | 0.8226943 | 0.5875152 | 0.3998399 | -0.3702477 | -0.5932758 | -0.6410445 | -0.6367021 | -0.0371287 | -0.1948907 | -0.1847719 | -0.2960626 | -0.1948908 | -0.4470770 | 0.5519007 | 0.5774232 | -0.5042200 | 0.1902414 | 0.2264617 | 0.2982966 | -0.1311483 |
| large_phytoplankton | -0.0437220 | -0.0630948 | -0.0334687 | 0.0124614 | -0.0064384 | 0.0023507 | -0.4816218 | -0.2924468 | -0.2973534 | 0.3653268 | -0.3212999 | -0.4518157 | 0.4969628 | 0.4603792 | 0.5309247 | 0.0829682 | -0.5269331 | 1.0000000 | -0.4869482 | -0.2672653 | -0.1720469 | 0.7621119 | 0.3678673 | 0.3491377 | 0.3536355 | -0.0932975 | 0.0749323 | 0.0653183 | 0.1988062 | 0.0749322 | 0.7219962 | -0.6069996 | -0.6720183 | 0.7939445 | -0.3671737 | 0.1038232 | -0.2684679 | 0.3465647 |
| synechococcus_population_1 | 0.1097342 | 0.1583561 | 0.0840001 | -0.0312758 | 0.0161591 | -0.0058999 | 0.1636278 | 0.4861053 | 0.5183612 | -0.5241176 | -0.2182022 | 0.2014414 | -0.0950366 | -0.0168358 | -0.1410379 | -0.3732082 | 0.8226943 | -0.4869482 | 1.0000000 | 0.5094623 | 0.3660911 | -0.3819175 | -0.7693998 | -0.8560692 | -0.8474607 | 0.0312325 | -0.0488555 | -0.0422892 | -0.1009496 | -0.0488556 | -0.5672934 | 0.7308696 | 0.7275292 | -0.5196306 | 0.1780433 | 0.1743362 | 0.4968932 | -0.3508249 |
| synechococcus_population_2 | -0.0530999 | -0.0766279 | -0.0406473 | 0.0151342 | -0.0078193 | 0.0028549 | -0.1231133 | -0.3531957 | -0.3029770 | 0.3225338 | 0.0592861 | 0.2773985 | -0.0809316 | -0.0254006 | -0.0828597 | -0.1399596 | 0.5875152 | -0.2672653 | 0.5094623 | 1.0000000 | 0.7995648 | -0.3332259 | -0.1077547 | -0.2349397 | -0.2191768 | -0.6740884 | -0.8005543 | -0.7951499 | -0.8193966 | -0.8005544 | -0.0688812 | 0.0852669 | 0.1732625 | -0.4010058 | -0.3754438 | 0.7860363 | -0.3463863 | -0.2603769 |
| prochlorococcus | -0.0485831 | -0.0701097 | -0.0371897 | 0.0138469 | -0.0071542 | 0.0026121 | -0.2893156 | -0.3698611 | -0.3145862 | 0.2879479 | 0.0323141 | 0.3374826 | -0.0041656 | 0.0380775 | -0.0164020 | 0.0154112 | 0.3998399 | -0.1720469 | 0.3660911 | 0.7995648 | 1.0000000 | -0.3507990 | 0.0322665 | -0.0963747 | -0.0804964 | -0.6260066 | -0.6544579 | -0.6549031 | -0.6108491 | -0.6544579 | -0.1007462 | 0.0529414 | 0.1314171 | -0.3689991 | -0.4246115 | 0.6277888 | -0.3421662 | -0.4729001 |
| lysbeths_mystery_cells_events | -0.0273381 | -0.0394513 | -0.0209270 | 0.0077918 | -0.0040257 | 0.0014698 | -0.4716154 | -0.2115388 | -0.1766901 | 0.3252597 | -0.4649042 | -0.6094626 | -0.1171863 | -0.1542340 | -0.0856175 | -0.2548711 | -0.3702477 | 0.7621119 | -0.3819175 | -0.3332259 | -0.3507990 | 1.0000000 | 0.3670784 | 0.3442067 | 0.3495393 | -0.0651722 | 0.1354199 | 0.1243553 | 0.2790907 | 0.1354198 | 0.8511118 | -0.6822382 | -0.7700944 | 0.9657956 | -0.4046617 | 0.1054890 | -0.2536396 | 0.4411663 |
| ksf_rdo_concentration | -0.1436172 | -0.2072523 | -0.1099371 | 0.0409330 | -0.0211486 | 0.0077216 | -0.5166439 | -0.8467521 | -0.7629781 | 0.8556151 | 0.1558650 | -0.0050217 | -0.1344232 | -0.2014642 | -0.1041178 | 0.1840851 | -0.5932758 | 0.3678673 | -0.7693998 | -0.1077547 | 0.0322665 | 0.3670784 | 1.0000000 | 0.9765582 | 0.9821534 | -0.5502957 | -0.3897929 | -0.4028860 | -0.2305997 | -0.3897928 | 0.6757126 | -0.8907914 | -0.8448696 | 0.4593779 | -0.6634529 | 0.2787107 | -0.8667498 | -0.0619751 |
| ksf_rdo_saturation | -0.1289034 | -0.1860190 | -0.0986739 | 0.0367393 | -0.0189819 | 0.0069305 | -0.3553506 | -0.7597832 | -0.6848098 | 0.7702641 | 0.2484340 | -0.0380127 | -0.1308590 | -0.2037169 | -0.0933389 | 0.2426998 | -0.6410445 | 0.3491377 | -0.8560692 | -0.2349397 | -0.0963747 | 0.3442067 | 0.9765582 | 1.0000000 | 0.9996129 | -0.3853456 | -0.2629421 | -0.2735110 | -0.1470312 | -0.2629420 | 0.6247268 | -0.8572075 | -0.8155171 | 0.4432484 | -0.4904801 | 0.1097702 | -0.7828262 | 0.0706893 |
| ksf_oxygen_partial_pressure | -0.1311758 | -0.1892982 | -0.1004133 | 0.0373870 | -0.0193165 | 0.0070527 | -0.3772395 | -0.7731839 | -0.6968818 | 0.7836693 | 0.2365961 | -0.0349428 | -0.1317650 | -0.2040706 | -0.0949881 | 0.2353614 | -0.6367021 | 0.3536355 | -0.8474607 | -0.2191768 | -0.0804964 | 0.3495393 | 0.9821534 | 0.9996129 | 1.0000000 | -0.4077199 | -0.2801222 | -0.2910399 | -0.1583445 | -0.2801220 | 0.6343435 | -0.8646840 | -0.8224603 | 0.4479191 | -0.5143834 | 0.1323988 | -0.7959801 | 0.0553053 |
| ksf_actual_conductivity | 0.1438958 | 0.2076543 | 0.1101503 | -0.0410123 | 0.0211896 | -0.0077365 | 0.6197604 | 0.8572035 | 0.7644578 | -0.8255741 | 0.0052714 | -0.2513800 | 0.1047154 | 0.1052736 | 0.1021954 | 0.0355366 | -0.0371287 | -0.0932975 | 0.0312325 | -0.6740884 | -0.6260066 | -0.0651722 | -0.5502957 | -0.3853456 | -0.4077199 | 1.0000000 | 0.9306242 | 0.9384989 | 0.7852146 | 0.9306242 | -0.4640337 | 0.5395568 | 0.4536599 | -0.0748907 | 0.8938922 | -0.9309962 | 0.8593425 | 0.3604171 |
| ksf_specific_conductivity | 0.1306499 | 0.1885393 | 0.1000108 | -0.0372371 | 0.0192391 | -0.0070244 | 0.3225874 | 0.7844858 | 0.6940880 | -0.7313530 | -0.1941453 | -0.3310065 | 0.1018370 | 0.0890158 | 0.0909207 | -0.0304794 | -0.1948907 | 0.0749323 | -0.0488555 | -0.8005543 | -0.6544579 | 0.1354199 | -0.3897929 | -0.2629421 | -0.2801222 | 0.9306242 | 1.0000000 | 0.9997509 | 0.9573459 | 1.0000000 | -0.3059309 | 0.3870947 | 0.2766679 | 0.1415035 | 0.6770654 | -0.9257949 | 0.7873004 | 0.1926573 |
| ksf_salinity | 0.1321445 | 0.1906962 | 0.1011549 | -0.0376631 | 0.0194592 | -0.0071047 | 0.3415458 | 0.7930486 | 0.7020285 | -0.7408918 | -0.1843236 | -0.3280774 | 0.1026068 | 0.0907086 | 0.0920965 | -0.0277145 | -0.1847719 | 0.0653183 | -0.0422892 | -0.7951499 | -0.6549031 | 0.1243553 | -0.4028860 | -0.2735110 | -0.2910399 | 0.9384989 | 0.9997509 | 1.0000000 | 0.9507261 | 0.9997509 | -0.3167402 | 0.3988015 | 0.2892473 | 0.1292450 | 0.6927715 | -0.9289061 | 0.7958387 | 0.2037399 |
| ksf_density | 0.1080420 | 0.1559142 | 0.0827048 | -0.0307935 | 0.0159099 | -0.0058089 | 0.0560902 | 0.6540607 | 0.5739821 | -0.5891799 | -0.3357863 | -0.3610691 | 0.0904010 | 0.0687774 | 0.0735761 | -0.0820428 | -0.2960626 | 0.1988062 | -0.1009496 | -0.8193966 | -0.6108491 | 0.2790907 | -0.2305997 | -0.1470312 | -0.1583445 | 0.7852146 | 0.9573459 | 0.9507261 | 1.0000000 | 0.9573459 | -0.1542281 | 0.2336338 | 0.1143598 | 0.2963736 | 0.4402645 | -0.8298473 | 0.6573191 | 0.0389534 |
| ksf_total_dissolved_solids | 0.1306499 | 0.1885393 | 0.1000108 | -0.0372371 | 0.0192391 | -0.0070244 | 0.3225874 | 0.7844857 | 0.6940879 | -0.7313529 | -0.1941452 | -0.3310064 | 0.1018370 | 0.0890157 | 0.0909207 | -0.0304793 | -0.1948908 | 0.0749322 | -0.0488556 | -0.8005544 | -0.6544579 | 0.1354198 | -0.3897928 | -0.2629420 | -0.2801220 | 0.9306242 | 1.0000000 | 0.9997509 | 0.9573459 | 1.0000000 | -0.3059310 | 0.3870946 | 0.2766679 | 0.1415035 | 0.6770654 | -0.9257950 | 0.7873003 | 0.1926573 |
| ksf_chlorophyll_a_fluorescence | -0.1107102 | -0.1597646 | -0.0847472 | 0.0315540 | -0.0163028 | 0.0059523 | -0.5650242 | -0.6416924 | -0.5881569 | 0.7228236 | -0.2367591 | -0.4157040 | -0.1197253 | -0.1650062 | -0.0765626 | -0.0973703 | -0.4470770 | 0.7219962 | -0.5672934 | -0.0688812 | -0.1007462 | 0.8511118 | 0.6757126 | 0.6247268 | 0.6343435 | -0.4640337 | -0.3059309 | -0.3167402 | -0.1542281 | -0.3059310 | 1.0000000 | -0.9334642 | -0.9591387 | 0.8905932 | -0.6779221 | 0.4449357 | -0.6827915 | 0.3875970 |
| ksf_ammonium | 0.1373160 | 0.1981592 | 0.1051136 | -0.0391370 | 0.0202207 | -0.0073828 | 0.5483843 | 0.8035290 | 0.7295025 | -0.8555610 | 0.0313374 | 0.2537830 | 0.1410965 | 0.2009432 | 0.0969253 | -0.0452545 | 0.5519007 | -0.6069996 | 0.7308696 | 0.0852669 | 0.0529414 | -0.6822382 | -0.8907914 | -0.8572075 | -0.8646840 | 0.5395568 | 0.3870947 | 0.3988015 | 0.2336338 | 0.3870946 | -0.9334642 | 1.0000000 | 0.9897069 | -0.7505590 | 0.7047299 | -0.4039899 | 0.8396753 | -0.2527003 |
| ksf_ammonium_m_v | 0.1237988 | 0.1786526 | 0.0947664 | -0.0352844 | 0.0182302 | -0.0066560 | 0.5623647 | 0.7207022 | 0.6576912 | -0.7877465 | 0.1140873 | 0.3362441 | 0.1307563 | 0.1915257 | 0.0873281 | -0.0062371 | 0.5774232 | -0.6720183 | 0.7275292 | 0.1732625 | 0.1314171 | -0.7700944 | -0.8448696 | -0.8155171 | -0.8224603 | 0.4536599 | 0.2766679 | 0.2892473 | 0.1143598 | 0.2766679 | -0.9591387 | 0.9897069 | 1.0000000 | -0.8359746 | 0.6720071 | -0.3348479 | 0.7586578 | -0.2940701 |
| ksf_barometric_pressure | -0.0489557 | -0.0706475 | -0.0374750 | 0.0139531 | -0.0072091 | 0.0026321 | -0.4978297 | -0.2696323 | -0.2600813 | 0.3821246 | -0.4225706 | -0.5945120 | -0.0672692 | -0.1136263 | -0.0335760 | -0.1699896 | -0.5042200 | 0.7939445 | -0.5196306 | -0.4010058 | -0.3689991 | 0.9657956 | 0.4593779 | 0.4432484 | 0.4479191 | -0.0748907 | 0.1415035 | 0.1292450 | 0.2963736 | 0.1415035 | 0.8905932 | -0.7505590 | -0.8359746 | 1.0000000 | -0.4311072 | 0.0798533 | -0.3086788 | 0.4359944 |
| outdoor_temperature | 0.1373359 | 0.1981878 | 0.1051289 | -0.0391427 | 0.0202236 | -0.0073839 | 0.8585334 | 0.8087275 | 0.7296081 | -0.8223712 | 0.2624077 | -0.0268099 | 0.0993488 | 0.1188869 | 0.0989055 | 0.1234077 | 0.1902414 | -0.3671737 | 0.1780433 | -0.3754438 | -0.4246115 | -0.4046617 | -0.6634529 | -0.4904801 | -0.5143834 | 0.8938922 | 0.6770654 | 0.6927715 | 0.4402645 | 0.6770654 | -0.6779221 | 0.7047299 | 0.6720071 | -0.4311072 | 1.0000000 | -0.7869352 | 0.8168574 | 0.3629596 |
| wind_speed_mph | -0.1165144 | -0.1681406 | -0.0891903 | 0.0332083 | -0.0171575 | 0.0062644 | -0.5033829 | -0.6944782 | -0.6189924 | 0.6758726 | -0.0929600 | 0.1617641 | -0.0852763 | -0.0644572 | -0.0805020 | -0.1355399 | 0.2264617 | 0.1038232 | 0.1743362 | 0.7860363 | 0.6277888 | 0.1054890 | 0.2787107 | 0.1097702 | 0.1323988 | -0.9309962 | -0.9257949 | -0.9289061 | -0.8298473 | -0.9257950 | 0.4449357 | -0.4039899 | -0.3348479 | 0.0798533 | -0.7869352 | 1.0000000 | -0.7006565 | -0.1779412 |
| hourly_rain_inch_hr | 0.1653751 | 0.2386508 | 0.1265925 | -0.0471342 | 0.0243526 | -0.0088914 | 0.5289864 | 0.9810440 | 0.8785684 | -0.9693002 | -0.1672147 | -0.1120089 | 0.1471302 | 0.1850664 | 0.1173145 | -0.1118940 | 0.2982966 | -0.2684679 | 0.4968932 | -0.3463863 | -0.3421662 | -0.2536396 | -0.8667498 | -0.7828262 | -0.7959801 | 0.8593425 | 0.7873004 | 0.7958387 | 0.6573191 | 0.7873003 | -0.6827915 | 0.8396753 | 0.7586578 | -0.3086788 | 0.8168574 | -0.7006565 | 1.0000000 | 0.0696926 |
| wind_direction | 0.0177785 | 0.0256559 | 0.0136092 | -0.0050671 | 0.0026180 | -0.0009559 | 0.4463074 | 0.1119834 | 0.0944497 | -0.0466016 | 0.1253806 | -0.4595305 | -0.0396601 | -0.0544627 | 0.0188051 | 0.0288094 | -0.1311483 | 0.3465647 | -0.3508249 | -0.2603769 | -0.4729001 | 0.4411663 | -0.0619751 | 0.0706893 | 0.0553053 | 0.3604171 | 0.1926573 | 0.2037399 | 0.0389534 | 0.1926573 | 0.3875970 | -0.2527003 | -0.2940701 | 0.4359944 | 0.3629596 | -0.1779412 | 0.0696926 | 1.0000000 |

Specific Relationship
Correlation Between Interpolated Weight and Interpolated Dissolved Oxygen
results <- corr.test(x = clams_growth_env_vars_interp$clams_count,
y = clams_growth_env_vars_interp$dissolved_oxygen,
method = "pearson", ci = TRUE)
print(results, short=FALSE)Call:corr.test(x = clams_growth_env_vars_interp$clams_count, y = clams_growth_env_vars_interp$dissolved_oxygen,
method = "pearson", ci = TRUE)
Correlation matrix
[1] 0.16
Sample Size
[1] 176
These are the unadjusted probability values.
The probability values adjusted for multiple tests are in the p.adj object.
[1] 0.03
Confidence intervals based upon normal theory. To get bootstrapped values, try cor.ci
raw.lower raw.r raw.upper raw.p lower.adj upper.adj
NA-NA 0.01 0.16 0.3 0.03 0.01 0.3
Adjusted P-Value
adjusted_p_values <- results$p.adj
print(adjusted_p_values)[1] 0.03178969
All Relationships
Specific Relationship
Visualizations
